<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use GeneaLabs\LaravelModelCaching\Traits\Cachable;

class Vehicle extends SortableModel
{
    use HasFactory;
    use Cachable;

    protected $fillable = [
        'introduction', 'price', 'vehicle_series_id', 'activity_id', 'name', 'code', 'img_url', 'min_img_url', 'describe', 'order', 'recommend', 'show'
    ];

    protected $casts = [
        'recommend' => 'boolean',
        'show' => 'boolean',
        'order' => 'integer',
    ];

    public function activity()
    {
        return $this->belongsTo(Activity::class);
    }

    public function series()
    {
        return $this->belongsTo(VehicleSeries::class, 'vehicle_series_id', 'id');
    }
}
